<include file="order@public/status"/>
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="{$tab=='notPaid'?'active':''}"><a href="{:url('AdminOrder/notPaid')}">未支付订单</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminOrder/'.$tab)}">
        订单ID：
        <input type="text" class="form-control" name="id" style="width: 100px;" value="{:input('request.id','')}"
               placeholder="请输入订单ID">
        订单编号：
        <input type="text" class="form-control" name="order_sn" style="width: 100px;"
               value="{:input('request.order_sn','')}" placeholder="订单编号">
        用户邮箱：
        <input type="text" class="form-control" name="email" style="width: 100px;" value="{:input('request.email','')}"
               placeholder="请输入邮箱">
        用户手机：
        <input type="text" class="form-control" name="mobile" style="width: 100px;"
               value="{:input('request.mobile','')}" placeholder="请输入手机">
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('AdminOrder/'.$tab)}">清空</a>
    </form>
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="16">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th>订单号</th>
                <th>客户</th>
                <th>单位</th>
                <!-- <th>收件人</th>
                <th>物流名称</th> -->
                <!--<th>支付方式</th>-->
                <th>下单时间</th>
                <!--<th>过期时间</th>-->
                <th>订单总价</th>
                <th>应收款</th>
                <th>{:lang('STATUS')}</th>
                <th align="center">{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="orders" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}">
                    </td>
                    <td>
                        <a href="javascript:;" onclick="openDetailDialog(this);" data-id="{$vo.id}"
                           data-toggle="tooltip" title="订单详情">
                            {$vo.order_sn}
                        </a>
                    </td>
                    <td>
                        {$customers[$vo['user_id']]['name']|default=''} <br>
                        {$customers[$vo['user_id']]['mobile']|default=''} <br>
                        {$customers[$vo['user_id']]['email']|default=''}
                    </td>
                    <td>
                        {$customers[$vo['user_id']]['company']|default=''}
                    </td>
                    <!-- <td>{$vo.consignee}</td>
                    <td>{$vo.shipment_name}</td> -->
                    <td>{:date('Y-m-d H:i',$vo['create_time'])}</td>
                    <td>￥{$vo.total_amount}</td>
                    <td>￥{$vo.order_amount}</td>
                    <td>
                        {$user_confirmed[$vo['user_confirmed']]}<br>
                        {$pay_status[$vo['pay_status']]}<br>
                        {$shipping_status[$vo['shipping_status']]}<br>
                        {$order_status[$vo['order_status']]}
                    </td>
                    <td>
                        <a href="{:url('order/AdminOrder/paid',array('id'=>$vo.id))}" class="js-ajax-dialog-btn" data-msg="您确定用户已经付款了吗？" >用户已支付</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
            <tfoot>
            <tr>
                <th width="16">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th>订单号</th>
                <th>客户</th>
                <th>单位</th>
                <!-- <th>收件人</th>
                <th>物流名称</th> -->
                <!--<th>支付方式</th>-->
                <th>下单时间</th>
                <!--<th>过期时间</th>-->
                <th>订单总价</th>
                <th>应收款</th>
                <th>{:lang('STATUS')}</th>
                <th align="center">{:lang('ACTIONS')}</th>
            </tr>
            </tfoot>
        </table>
        <ul class="pagination">{$page}</ul>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    function openDetailDialog(obj) {
        var $obj  = $(obj);
        var id    = $obj.data('id');
        var title = $obj.data('title');
        parent.openIframeLayer("{:url('AdminOrder/detail')}?id=" + id, '订单详情', {
            area: ['95%', '90%'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                console.log(layero);
                var iframeWin = parent.window[layero.find('iframe')[0]['name']];
                //iframeWin.confirm();
                parent.layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }
</script>
</body>
</html>